<template>
    <view>
        <uni-list>
            <uni-list-item
                v-for="(item, index) in sourceRecord"
                :key="index"
                :title="index + 1 + '.来源：' + item.spScna"
                :rightText="item.spVldy && new Date().getUTCTime() > item.spVldy ? '已过期' : '有效'"
                :note="'购买数：' + item.spQuat + ' / 剩余数：' + item.spSpqu"
            >
                <!-- <template v-slot:body>
                    <div style="flex: 1; margin-left: 10px; display: flex">
                        <view style="margin-left: 10px">{{ "购买数：" + item.spQuat }}</view>
                        <view style="margin-left: 10px">{{ "剩余数：" + item.spSpqu }}</view>
                    </div>
                </template> -->
            </uni-list-item>
        </uni-list>
    </view>
</template>

<script>
import { getMyServiceItemSource } from "../../utils/api";
import { mapGetters } from "vuex";

export default {
    components: {},
    data() {
        return {
            sourceRecord: [],
        };
    },

    async onLoad(params) {
        let res = await getMyServiceItemSource({ ciUuid: this.userInfo.ciUuid, siUuid: params.siUuid });
        res && (this.sourceRecord = res);
    },

    computed: {
        ...mapGetters({
            userInfo: "personInfo/userInfo",
        }),
    },

    methods: {},
};
</script>

<style lang="scss" scoped></style>
